<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增设备库区')" />
	<th:block th:include="include :: select2-css" />
</head>
<body>
    <div class="main-content">
        <form id="form-user-add" class="form-horizontal">
            <h4 class="form-header h4">设备库房区域信息</h4>
            <div class="row">
            	<div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">货区id：</label>
                        <div class="col-sm-8">
                            <input name="cargo_area_id" placeholder="请输入货区id" class="form-control" type="text" maxlength="30" required>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">仓库id：</label>
                        <div class="col-sm-8">
                            	<input name="warehouse_id" id="warehouse_id" type="text" placeholder="请输入仓库Id" class="form-control">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">货区名称：</label>
                        <div class="col-sm-8">
                                <input id="cargo_area_name" name="cargo_area_name" placeholder="请输入货区名称" class="form-control" type="text" maxlength="11">

                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">货区描述：</label>
                        <div class="col-sm-8">
                                <input id="c_desc" name="c_desc" class="form-control" type="text" maxlength="50" placeholder="请输入货区描述">
                        </div>
                        </div>
                    </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label ">物资分类id：</label>
                        <div class="col-sm-8">
                            <input id="productkind_id" name="productkind_id" placeholder="请输入物资分类id" class="form-control" type="text" maxlength="30" >
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">是否为默认分区：</label>
                        <div class="col-sm-8">
                            <select name="is_default" class="form-control m-b" required>
                                <option value="Y">是</option>
                                <option value="N">否</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">是否锁定：</label>
                        <div class="col-sm-8">
                            <label class="toggle-switch switch-solid">
	                            <input type="checkbox" id="locked" checked>
	                            <span></span>
	                        </label>
                        </div>
                    </div>
                </div>
            </div>

        </form>
    </div>
      
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: select2-js" />
	<script>
	    var prefix =ctx + "device/cargoArea";

        function submitHandler() {
	        if ($.validate.form()) {
	        	var data = $("#form-user-add").serializeArray();
	        	var locked = $("input[id='locked']").is(':checked') == true ? "Y" :"N";
	        	var is_default = $.form.selectCheckeds("is_default");
	        	data.push({"name": "locked", "value": locked});
	        	data.push({"name": "is_default", "value": is_default});
	        	$.operate.saveTab(prefix + "/add", data);
	        }
	    }
    </script>
</body>
</html>